﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveTrigger : MonoBehaviour {

    public Transform currentBg;
    public Pipe pipe1;
    public Pipe pipe2;


    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Vector3 pos = currentBg.localPosition;
            Vector3 firstPos = GameManager.instance.firstBg.transform.localPosition;
            currentBg.localPosition = new Vector3(firstPos.x + 10, pos.y, pos.z);
            GameManager.instance.firstBg = currentBg;

            pipe1.RandomGeneratePosition();
            pipe2.RandomGeneratePosition();
        }
    }
}
